#include"initpipe.hpp"
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
#include"log.hpp"


int main()
{
    Log log;
    log.enable(ClassFile);
    int fd = open(FIFO_FILE,O_WRONLY);
    if(fd < 0)
    {
        log(Fatal,"error string is:%s,error code is:%d",strerror(errno),errno);
        exit(FILE_OPEN_ERR);
    }

    log.enable(ClassFile);

    std::string buffer;
    while(true)
    {
        std::cout << "Please Enter@ ";
        std::getline(std::cin,buffer);
        write(fd,buffer.c_str(),buffer.size());
    }

    close(fd);
    return 0;
}